import React, { Component } from 'react'
import Item from './Item'
export default class List extends Component {
  render() {
    return (
      <div>
        {this.props.todos.length > 0 ? (
          <ul className="list-group">
            {this.props.todos.map((todo) => {
              return (
                <Item
                  key={todo.id}
                  {...todo}
                  change={this.props.change}
                  click={this.props.click}
                />
              )
            })}
          </ul>
        ) : (
          <div>暂无数据</div>
        )}
      </div>
    )
  }
}
